<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Editar Questionário</h2>
            <p:panel style="background: none; border: none;" > 
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="5000"/>

                    <p class="subtitle">Perguntas e Respostas</p>

                        <ui:repeat value="#{managerEditCategory.categorys}" var="c">
                            <table id="tables" style="width:100%;">
                                <tr style="color:#3DA2DC; width: 100%; font-size: 13px; font-family: sans-serif">
                                    <td>
                                        <p:panel header="#{c.name} " style="border: 0px; width:100%;"/>         
                                    </td>       
                                    <td>
                                        <p:commandButton  icon="ui-icon-circle-plus" style="width: 30px; height: 35px;" title="Nova Pergunta" actionListener="#{managerEditCategory.viewTheme(c)}" update="@form" immediate="true"/>
                                    </td> 
                                </tr> 
                            </table>

                            <ul>
                                <ol style="padding-left: 30px; color: #000000;">

                                    <ui:repeat value="#{c.issueses}" var="i">
                                        <table style="float : right;position: relative">
                                            <tr>
                                                <td>
                                                    <p:commandButton icon="ui-icon-document" style="width: 30px; height: 35px;" title="Editar Pergunta" actionListener="#{managerEditIssues.redirect('editIssuesOne.xhtml', i)}"  update="@form" immediate="true"/> 
                                                    <p:commandButton icon="ui-icon-close"  actionListener="#{managerEditCategory.resgateIssues(i)}" onclick="dialog.show();" 
                                                                     style="width: 30px; height: 35px;" update=":form:dialogPanel" immediate="true" title="Remover Pergunta" />
                                                </td>
                                            </tr>
                                        </table>
                                        <li style="font-weight: bold;width: 90%;float: left;min-height: 14px">
                                            <span  style="color: #000000; font-weight: bold;" > #{i.title} </span> 

                                        </li>

                                        <ol type="a" class="opt" style=" vertical-align: top ;width: 100%;float: left">

                                            <p:inputTextarea rendered="#{i.typeIssues eq 'OPEN'}" cols="60" />

                                            <ui:repeat  value="#{i.options}" var="o">
                                                <li style="float: left;width: 100%;padding-left: 25px"> 
                                                    <p:selectOneRadio rendered="#{i.typeIssues eq 'CHOOSEONE'}" style="float: left;display: block" id="options" >    <f:selectItem itemLabel="" itemValue="1" />   </p:selectOneRadio>
                                                    <p:selectBooleanCheckbox  rendered="#{i.typeIssues eq 'CHOICEMULTIPLE'}" />  
                                                    <span >#{o.title} </span>

                                                </li>

                                            </ui:repeat>

                                            <h:outputText value="Orientação * " style="color: #3DA2DC; font-weight: bold" rendered="#{i.orientacion eq empty 'null'}"/>
                                            <h:outputText value="#{i.orientacion}" rendered="#{i.orientacion eq empty 'null'}"/> 
                                        </ol>

                                    </ui:repeat>
 
                                </ol>

                            </ul>

                        </ui:repeat>
                    <center>
                        <p:commandButton value="Voltar" icon="ui-icon-arrowreturnthick-1-w" style="font-size: 12px; font-family: sans-serif;" actionListener="#{managerRedirect.redirect('viewQuestionnaire.xhtml')}" immediate="true"/>
                    </center>
                   <p:dialog id="dialog" showHeader="true" modal="false"
                              showEffect="explode"  width="30%"
                              widgetVar="dialog" header="Informação" style="background: #F1F2E9; ">
                        
                        <h:panelGrid  id="dialogPanel" columns="2" style="font-size: 12px;">
                            <p:commandButton value="Sim" actionListener="#{managerEditCategory.deleteIssues()}" process="@this" immediate="true" update="@form"/>
                            <p:commandButton value="Não" actionListener="dialog.hide();" process="@this" update="@form"/>
                            
                        </h:panelGrid>
                        <br/>
                        
                    </p:dialog>
                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>
</html>





